import { postRequest, getRequest, postRequestData, postRequestJson, postRequestList } from '../utils/request'
// 路由管理
export const getAllRouteTree = <T>(data?: any): Promise<IResponseData<T>> =>
  postRequestData(`/api/sop/sop/system/route/getRouteTree`, data)
export const getUserButton = <T>(data?: any): Promise<IResponsePost<T>> =>
  postRequestJson(`/api/sop/sop/system/route/getUserButton`, data)

export const addRoutes = <T>(data?: any): Promise<IResponsePost<T>> =>
  postRequest(`/api/sop/sop/system/route/saveRoute`, data)

export const editRoutes = <T>(data?: any): Promise<IResponsePost<T>> =>
  postRequest(`/api/sop/sop/system/route/updateRoute`, data)

export const delRouteById = <T>(data?: any): Promise<IResponsePost<T>> =>
  postRequestJson(`/api/sop/sop/system/route/deleteRoute`, data)

export const userLogin = <T>(data?: any): Promise<IResponsePost<T>> => postRequestJson(`/api/auth/auth/login`, data)
export const userLoginOut = <T>(data?: any): Promise<IResponsePost<T>> => postRequestJson(`/api/auth/auth/logout`, data)

export const userLoginByDDQrcode = <T>(data?: any): Promise<IResponsePost<T>> =>
  postRequestJson(`/api/auth/auth/loginbyauthcode`, data)

export const userFirstLoginChangePassword = <T>(data?: any): Promise<IResponsePost<T>> =>
  postRequestJson(`/api/sop/sop/system/user/updatePassword`, data)

export const getLogInfos = <T>(data?: any): Promise<IResponsePost<T>> =>
  postRequestJson(`/api/sop/sop/operationLog/query`, data)

//文件模版
export const pageExcelTemplate = <T>(data?: any): Promise<IResponseList<T>> =>
  postRequestList(`/api/sop/sop/file/pageExcelTemplate`, data)
export const uploadExcelTemplate = <T>(data?: any): Promise<IResponseList<T>> =>
  postRequestList(`/api/sop/sop/file/uploadExcelTemplate`, data)
export const getFileTempById = <T>(data?: any): Promise<IResponsePost<T>> =>
  postRequestJson(`/api/sop/sop/file/getById`, data)
export const editExcelTemplate = <T>(data?: any): Promise<IResponseList<T>> =>
  postRequestList(`/api/sop/sop/file/editExcelTemplate`, data)

export const getListSysAnnouncement = <T>(data?: any): Promise<IResponseList<T>> =>
  postRequestList(`/api/sop/sop/sysAnnouncement/listSysAnnouncement`, data)
export const saveSysAnnouncement = <T>(data?: any): Promise<IResponsePost<T>> =>
  postRequestJson(`/api/sop/sop/sysAnnouncement/saveSysAnnouncement`, data)
export const getShowSysAnnouncement = <T>(data?: any): Promise<IResponseDetail<T>> =>
  postRequestJson(`/api/sop/sop/sysAnnouncement/showSysAnnouncement`, data)
